﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SaCoderZ___POS___WPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            ClearTextBoxes();
        }

        private void ClearTextBoxes()
        {
            foreach (var x in LogicalTreeHelper.GetChildren(Grid1))
            {
                if (x is TextBox)
                    ((TextBox)x).Text = null;
            }
            txtUser.Focus();
        }
               

        private void txtUser_GotFocus(object sender, RoutedEventArgs e)
        {
            txtUser.Background = Brushes.Blue; 
        }

        private void txtUser_LostFocus(object sender, RoutedEventArgs e)
        {
            txtUser.Background = Brushes.White; 
        }

        private void txtPassword_GotFocus(object sender, RoutedEventArgs e)
        {
            txtPassword.Background = Brushes.Blue; 
        }

        private void txtPassword_LostFocus(object sender, RoutedEventArgs e)
        {
            txtPassword.Background = Brushes.White; 
        }
        
        private void btnClear_Click(object sender, RoutedEventArgs e)
        {
            ClearTextBoxes();
        }

        private void btnLogon_Click(object sender, RoutedEventArgs e)
        {
            if (txtUser.Text == "BigkahunA")
            {
                frmOptions frmOptions = new frmOptions();
                frmOptions.Show();
                this.Close();
            }
            else
            {
                frmPos frmPos = new frmPos();
                frmPos.Show();
                this.Close();
            }

            
        }
               
             
    }
}
